﻿using Core.Interface;
using Prism.Commands;
using Prism.Ioc;
using Prism.Mvvm;
using System.Windows.Input;

namespace ProcessControl.ViewModels
{
    public class StartStopViewModel : BindableBase
    {
        IAutoProcess autoProcess;
        //构造函数注入
        public StartStopViewModel(IContainerExtension container)
        {
            autoProcess = container.Resolve<IAutoProcess>();
        }
        #region
        public ICommand IniCommand
        { get => new DelegateCommand(Ini); }
        private void Ini()
        {
            autoProcess?.Init();
        }

        public ICommand StartCommand
        { get => new DelegateCommand(Start); }
        private void Start()
        {
            autoProcess?.Start();
        }

        public ICommand StopCommand
        { get => new DelegateCommand(Stop); }
        private void Stop()
        {
            autoProcess?.Stop();
        }
        #endregion
    }
}
